import request from '@/utils/request.js'

// 轮播图
export const getBanner = () => request( {
	url: '/getlunbo',
} )

// 新闻列表
export const getNewslist = () => request( {
	url: '/getnewslist',
} )

// 新闻详情
export const getArticle = id => request( {
	url: '/getnew/' + id
} )

// 图片缩略图
export const getThumimages = id => request( {
	url: '/getthumimages/' + id
} )

// 图片详情
export const getImageInfo = id => request( {
	url: '/getimageInfo/' + id
} )

// 评论列表
export const getComments = ( id, pageindex ) => request( {
	url: `/getcomments/${id}?pageindex=${pageindex}`
} )

// 发布评论
export const postComment = ( id, data ) => request( {
	method: 'post',
	url: `/postcomment/${id}`,
	data
} )

// 图片分类
export const getImgCategory = () => request( {
	url: '/getimgcategory',
} )

// 图片
export const getImages = id => request( {
	url: '/getimages/' + id,
} )

// 商品
export const getGoods = pageindex => request( {
	url: '/getgoods?pageindex=' + pageindex
} )

// 图文详情
export const getGoodsDesc = id => request( {
	url: '/goods/getdesc/' + id
} )

// 商品详情
export const getGoodsInfo = id => request( {
	url: '/goods/getinfo/' + id
} )

// 购物车
export const getShopcarlist = (...ids) => request( {
	url: `/goods/getshopcarlist/` + ids.join( ',' )
} )
